﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTR.News.AdminModel;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlClient;
using GTR.News.AdminModel;
using System.Data;


namespace GTR.News.AdminDAL
{
    public class CommentDAL
    {

        /// <summary>
        /// 评论表显示
        /// </summary>
        /// <returns></returns>
        public DataTable Commentxian() 
        {
            string str = "select CommentID,ComContent,ComDate from Comment";
            return DBhelper.GetTable(str);

        }
        /// <summary>
        /// 评论添加
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public int Commentadd(Comment c)
        {
            string st = string.Format("insert into Comment value('{0}','{1}',{2},{3}",c.ComContent,c.ComDate,c.NewsID,c.MemberID);
            return DBhelper.NonQuery(st);

        }



        //public int commADD(Comment c)
        //{
        //    string s = "insert into Comment values('" + c.ComContent + "','" + c.ComDate + "','" + c.NewsID + "','" + c.MemberID + "')";
        //    return DBhelper.NonQuery(s);
        //}
        /// <summary>
        /// 删除评论表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int commDEL(int id)
        {
            return DBhelper.NonQuery("delete from Comment where CommentID=" + id);
        }









    }
}
